3.7.81 \(\int (a+i a \tan (e+f x))^2 (A+B \tan (e+f x)) (c-i c \tan (e+f x)) \, dx\) [681]

Optimal. Leaf size=64 \[ \frac {a^2 A c \tan (e+f x)}{f}+\frac {a^2 (i A+B) c \tan ^2(e+f x)}{2 f}+\frac {i a^2 B c \tan ^3(e+f x)}{3 f} \]

[Out]

a^2*A*c*tan(f*x+e)/f+1/2*a^2*(I*A+B)*c*tan(f*x+e)^2/f+1/3*I*a^2*B*c*tan(f*x+e)^3/f

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 64, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3669, 45} \begin {gather*} \frac {a^2 c (B+i A) \tan ^2(e+f x)}{2 f}+\frac {a^2 A c \tan (e+f x)}{f}+\frac {i a^2 B c \tan ^3(e+f x)}{3 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x]),x]

[Out]

(a^2*A*c*Tan[e + f*x])/f + (a^2*(I*A + B)*c*Tan[e + f*x]^2)/(2*f) + ((I/3)*a^2*B*c*Tan[e + f*x]^3)/f

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int (a+i a \tan (e+f x))^2 (A+B \tan (e+f x)) (c-i c \tan (e+f x)) \, dx &=\frac {(a c) \text {Subst}(\int (a+i a x) (A+B x) \, dx,x,\tan (e+f x))}{f}\\ &=\frac {(a c) \text {Subst}\left (\int \left (a A+a (i A+B) x+i a B x^2\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {a^2 A c \tan (e+f x)}{f}+\frac {a^2 (i A+B) c \tan ^2(e+f x)}{2 f}+\frac {i a^2 B c \tan ^3(e+f x)}{3 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.90, size = 109, normalized size = 1.70 \begin {gather*} \frac {a^2 c \sec (e) \sec ^3(e+f x) (3 (i A+B) \cos (f x)+3 (i A+B) \cos (2 e+f x)+6 A \sin (f x)-3 A \sin (2 e+f x)+3 i B \sin (2 e+f x)+3 A \sin (2 e+3 f x)-i B \sin (2 e+3 f x))}{12 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x]),x]

[Out]

(a^2*c*Sec[e]*Sec[e + f*x]^3*(3*(I*A + B)*Cos[f*x] + 3*(I*A + B)*Cos[2*e + f*x] + 6*A*Sin[f*x] - 3*A*Sin[2*e +
 f*x] + (3*I)*B*Sin[2*e + f*x] + 3*A*Sin[2*e + 3*f*x] - I*B*Sin[2*e + 3*f*x]))/(12*f)

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 51, normalized size = 0.80

method result size
derivativedivides \(-\frac {i a^{2} c \left (-\frac {B \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {\left (i B -A \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2}+i A \tan \left (f x +e \right )\right )}{f}\) \(51\)
default \(-\frac {i a^{2} c \left (-\frac {B \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {\left (i B -A \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2}+i A \tan \left (f x +e \right )\right )}{f}\) \(51\)
norman \(\frac {a^{2} A c \tan \left (f x +e \right )}{f}+\frac {\left (i A \,a^{2} c +B \,a^{2} c \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {i a^{2} B c \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}\) \(64\)
risch \(\frac {2 a^{2} c \left (6 i A \,{\mathrm e}^{4 i \left (f x +e \right )}+6 B \,{\mathrm e}^{4 i \left (f x +e \right )}+9 i A \,{\mathrm e}^{2 i \left (f x +e \right )}+3 B \,{\mathrm e}^{2 i \left (f x +e \right )}+3 i A +B \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) \(79\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

-I/f*a^2*c*(-1/3*B*tan(f*x+e)^3+1/2*(-A+I*B)*tan(f*x+e)^2+I*A*tan(f*x+e))

________________________________________________________________________________________

Maxima [A]
time = 0.54, size = 56, normalized size = 0.88 \begin {gather*} -\frac {-2 i \, B a^{2} c \tan \left (f x + e\right )^{3} - 3 \, {\left (i \, A + B\right )} a^{2} c \tan \left (f x + e\right )^{2} - 6 \, A a^{2} c \tan \left (f x + e\right )}{6 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e)),x, algorithm="maxima")

[Out]

-1/6*(-2*I*B*a^2*c*tan(f*x + e)^3 - 3*(I*A + B)*a^2*c*tan(f*x + e)^2 - 6*A*a^2*c*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]
time = 1.99, size = 103, normalized size = 1.61 \begin {gather*} -\frac {2 \, {\left (6 \, {\left (-i \, A - B\right )} a^{2} c e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (-3 i \, A - B\right )} a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-3 i \, A - B\right )} a^{2} c\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e)),x, algorithm="fricas")

[Out]

-2/3*(6*(-I*A - B)*a^2*c*e^(4*I*f*x + 4*I*e) + 3*(-3*I*A - B)*a^2*c*e^(2*I*f*x + 2*I*e) + (-3*I*A - B)*a^2*c)/
(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(2*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 158 vs. \(2 (56) = 112\).
time = 0.22, size = 158, normalized size = 2.47 \begin {gather*} \frac {6 i A a^{2} c + 2 B a^{2} c + \left (18 i A a^{2} c e^{2 i e} + 6 B a^{2} c e^{2 i e}\right ) e^{2 i f x} + \left (12 i A a^{2} c e^{4 i e} + 12 B a^{2} c e^{4 i e}\right ) e^{4 i f x}}{3 f e^{6 i e} e^{6 i f x} + 9 f e^{4 i e} e^{4 i f x} + 9 f e^{2 i e} e^{2 i f x} + 3 f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e)),x)

[Out]

(6*I*A*a**2*c + 2*B*a**2*c + (18*I*A*a**2*c*exp(2*I*e) + 6*B*a**2*c*exp(2*I*e))*exp(2*I*f*x) + (12*I*A*a**2*c*
exp(4*I*e) + 12*B*a**2*c*exp(4*I*e))*exp(4*I*f*x))/(3*f*exp(6*I*e)*exp(6*I*f*x) + 9*f*exp(4*I*e)*exp(4*I*f*x)
+ 9*f*exp(2*I*e)*exp(2*I*f*x) + 3*f)

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 127 vs. \(2 (59) = 118\).
time = 0.59, size = 127, normalized size = 1.98 \begin {gather*} -\frac {2 \, {\left (-6 i \, A a^{2} c e^{\left (4 i \, f x + 4 i \, e\right )} - 6 \, B a^{2} c e^{\left (4 i \, f x + 4 i \, e\right )} - 9 i \, A a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} - 3 \, B a^{2} c e^{\left (2 i \, f x + 2 i \, e\right )} - 3 i \, A a^{2} c - B a^{2} c\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e)),x, algorithm="giac")

[Out]

-2/3*(-6*I*A*a^2*c*e^(4*I*f*x + 4*I*e) - 6*B*a^2*c*e^(4*I*f*x + 4*I*e) - 9*I*A*a^2*c*e^(2*I*f*x + 2*I*e) - 3*B
*a^2*c*e^(2*I*f*x + 2*I*e) - 3*I*A*a^2*c - B*a^2*c)/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(
2*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Mupad [B]
time = 8.53, size = 50, normalized size = 0.78 \begin {gather*} \frac {a^2\,c\,\mathrm {tan}\left (e+f\,x\right )\,\left (6\,A+A\,\mathrm {tan}\left (e+f\,x\right )\,3{}\mathrm {i}+3\,B\,\mathrm {tan}\left (e+f\,x\right )+B\,{\mathrm {tan}\left (e+f\,x\right )}^2\,2{}\mathrm {i}\right )}{6\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^2*(c - c*tan(e + f*x)*1i),x)

[Out]

(a^2*c*tan(e + f*x)*(6*A + A*tan(e + f*x)*3i + 3*B*tan(e + f*x) + B*tan(e + f*x)^2*2i))/(6*f)

________________________________________________________________________________________